
lst = [1, 10, 22, 33, 42, 45, 68, 88, 89, 92]
# 二分查找
# 目标数是42的索引值是多少
def find(lst, t, start, end):
    if end > start:
        mid = start+(end-start)//2
        if lst[mid] == t:
            return mid
        elif lst[mid] > t:
            return find(lst, t, start, mid)
        else:
            return find(lst, t, mid+1, end)
    else:
        return -1


print(find(lst, 35, 0, len(lst)))





# for i in range(len(lst)):
#     if lst[i] == 42:
#         print(i)
#         break
# print(lst.index(42))